home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 071-080 / amok74 / coords / coords.mod < prev    next >
Text File  |  1993-11-04  |  3KB  |  104 lines

  1. (* -------------------------------------------------------------------------
  2.   :Program.       Coords
  3.   :Contents.      shows the position of the mouse
  4.   :Author.        Holger Bolay
  5.   :Address.       Hoffmannstraße 168
  6.   :Address.       D-7250 Leonberg 1
  7.   :History.       v1.0 Holger 21-Mar-92
  8.   :Copyright.     Public Domain
  9.   :Language.      Oberon
  10.   :Translator.    AMIGA OBERON v2.42d
  11. ------------------------------------------------------------------------- *)
  12. MODULE Coords;
  13.  
  14. IMPORT y:  SYSTEM,
  15.        ol: OberonLib,
  16.        g:  Graphics,
  17.        d:  Dos,
  18.        e:  Exec,
  19.        I:  Intuition,
  20.        u:  Utility,
  21.        so: StringOps;
  22.  
  23. VAR mywin:  I.WindowPtr;
  24.     nw:     I.NewWindow;
  25.     title:  ARRAY 40 OF CHAR;
  26.     tmp:    ARRAY 5 OF CHAR;
  27.     msg:    I.IntuiMessagePtr;
  28.     time:   d.Date;
  29.     gad:    I.GadgetPtr;
  30.     type:   SET;
  31.     Depth:  INTEGER;
  32.  
  33. CONST SysSet = y.VAL (SET, I.sysGadget);
  34.       CloseSet = y.VAL (SET, I.close) + SysSet;
  35.       wUpSet = y.VAL (SET, I.wUpFront) + SysSet;
  36.       wDownSet = y.VAL (SET, I.wDownBack) + SysSet;
  37.       TitleTemplate = "x: 0000  y: 0000\o$VER: Coords 1.0 (21-Mar-92)\n\r";
  38.  
  39. PROCEDURE OverWriteInt(li: LONGINT; l, p: INTEGER; z: BOOLEAN);
  40. BEGIN
  41.   so.IntToStr(li, tmp);
  42.   IF z THEN
  43.     so.LeftInsertZeroes(tmp, l);
  44.   ELSE
  45.     so.RightAdjust(tmp, l);
  46.   END; (* IF *)
  47.   so.OverWrite(title, tmp, p);
  48. END OverWriteInt;
  49.  
  50. BEGIN
  51.   IF d.dos.lib.version<37 THEN HALT(20) END;
  52.   mywin := I.OpenWindowTagsA(NIL,
  53.                I.waLeft,          0,
  54.                I.waTop,           0,
  55.                I.waWidth,         1,
  56.                I.waHeight,        1,
  57.                I.waIDCMP,         y.VAL(LONGINT, LONGSET{I.closeWindow}),
  58.                I.waCloseGadget,   I.LTRUE,
  59.                I.waDepthGadget,   I.LTRUE,
  60.                I.waDragBar,       I.LTRUE,
  61.                I.waSimpleRefresh, I.LTRUE,
  62.                I.waNoCareRefresh, I.LTRUE,
  63.                I.waRMBTrap,       I.LTRUE,
  64.              u.done);
  65.  
  66.   IF mywin = NIL THEN HALT(20) END;
  67.   nw.height := mywin^.wScreen.barHeight;
  68.  
  69.   title := TitleTemplate;
  70.   nw.width := g.TextLength(y.ADR(mywin^.wScreen^.rastPort),
  71.                            title, 17);
  72.   gad := mywin^.firstGadget;
  73.   Depth := 0;
  74.   WHILE gad#NIL DO
  75.     type := y.VAL (SET, gad^.gadgetType);
  76.     IF (type*CloseSet = CloseSet) OR (type*wUpSet = wUpSet) OR
  77.        (type*wDownSet = wDownSet) THEN
  78.       INC(nw.width, gad.width);
  79.     END;
  80.     IF (type*wUpSet = wUpSet) OR (type*wDownSet = wDownSet) THEN
  81.       INC(Depth, gad.width);
  82.     END;
  83.     gad := gad^.nextGadget;
  84.   END;
  85.   I.MoveWindow(mywin, mywin^.wScreen^.width-Depth-nw.width, 0);
  86.   I.SizeWindow(mywin, nw.width, nw.height);
  87.   LOOP
  88.     d.Delay(5);
  89.     OverWriteInt(mywin^.mouseX+mywin^.leftEdge, 4, 3, TRUE);
  90.     OverWriteInt(mywin^.mouseY+mywin^.topEdge, 4, 12, TRUE);
  91.     I.SetWindowTitles(mywin, y.ADR(title), -1);
  92.     msg := e.GetMsg(mywin^.userPort);
  93.     IF msg#NIL THEN
  94.       IF I.closeWindow IN msg^.class THEN
  95.          e.ReplyMsg(msg);
  96.          EXIT;
  97.       END;
  98.       e.ReplyMsg(msg);
  99.     END;
  100.   END; (* LOOP *)
  101. CLOSE
  102.   IF mywin#NIL THEN I.CloseWindow(mywin); mywin := NIL END;
  103. END Coords.
  104.